/*
 * peg.cpp
 *
 *  Created on: 10 déc. 2011
 *      Author: Elca
 */
#include "def.hpp"
#include "BoardInfos.hpp"
#include "File.h"
#include "HazardQueue.h"
#include "Solver.hpp"
#include <iostream>
#include <ctime>
#include <omp.h>
//#include <atomic>
using namespace std;
using namespace pcm;

//Level 4
//Number solutions: 0
//Number solutions: 14
//Number solutions: 14
//Number solutions: 14
//Number solutions: 0
//Number solutions: 14
//Number solutions: 0
//Number solutions: 14
//Number solutions: 14
//Number solutions: 0
//Level 5
//Number solutions: 29760
//Number solutions: 14880
//Number solutions: 14880
//Number solutions: 85258
//Number solutions: 1550
//Number solutions: 85258
//Number solutions: 14880
//Number solutions: 1550
//Number solutions: 1550
//Number solutions: 14880
//Number solutions: 29760
//Number solutions: 14880
//Number solutions: 85258
//Number solutions: 14880
//Number solutions: 29760
//Level 6
//Number solutions: 43419942138
//Number solutions: 82905434589
//Number solutions: 82905434589
//Number solutions: 113077359159
//Number solutions: 29235690234
//Number solutions: 113077359159
//Number solutions: 113077359159
//Number solutions: 266871356732
//Number solutions: 266871356732
//Number solutions: 113077359159
//Number solutions: 82905434589
//Number solutions: 29235690234
//Number solutions: 266871356732
//Number solutions: 29235690234
//Number solutions: 82905434589
//Number solutions: 43419942138
//Number solutions: 82905434589
//Number solutions: 113077359159
//Number solutions: 113077359159
//Number solutions: 82905434589
//Number solutions: 43419942138
//Level 7
//Number solutions: 0
//Number solutions: 422164782932465380
//Number solutions: 422164782932465380
int main(int argc, char* argv[]){

	cout << sizeof(LL)<<endl;
	omp_set_nested(1);
	omp_set_num_threads(2);
#pragma omp parallel num_threads(0)
{
#pragma omp critical
{
	cout <<"NumberThread:"<<omp_get_max_threads()<<endl;
	cout <<"MaxNested:"<<omp_get_nested()<<endl;
	cout <<"id:"<<omp_get_thread_num()<<endl;
}
}
	clock_t init, final;
	
	BoardInfos board;
	board.updateGameInfos(5);
	//board.initBoard(1);

	for(int i=0;i<BoardInfos::gameNumberHole();i++){
		init = clock();
		board.initBoard(i);
		Solver solver;
		solver.solve(board);
		final=clock()-init;
		cout << "Time in second :"<<(double)final / ((double)CLOCKS_PER_SEC)<<endl;
	}
	cout << "Delete last main:"<<BoardInfos::cons<<endl;
	
	/*
	File file1;
	file1.initializeQueue();
	file1.enq(&board);
	
	BoardInfos board1;
	board1.updateGameInfos(4);
	board1.initBoard(5);
	
	file1.deq()->printBoard();
	file1.enq(&board1);
	file1.deq()->printBoard();
	
	BoardInfos* elem;
	if ((elem = file1.deq())!= NULL) {
		elem->printBoard();
	}else {
		cout << "null\n";
	}
	 */

	
	/*BoardInfos boardhq;
	boardhq.updateGameInfos(4);
	boardhq.initBoard(0);
	HazardQueue queue1;
	queue1.initializeQueue();
	queue1.enq(&boardhq,1);
	
	BoardInfos boardhq2;
	boardhq2.updateGameInfos(4);
	boardhq2.initBoard(5);
	
	queue1.deq(1)->printBoard();
	queue1.enq(&boardhq2,1);
	queue1.deq(1)->printBoard();
	
	BoardInfos* elem;
	if ((elem = queue1.deq(1))!= NULL) {
		elem->printBoard();
	}else {
		cout << "null\n";
	}*/

	
	
//	Solver solver;
//	solver.solve(board);
	
	
	
	//board.printHolePos();
	//board.printBoard();
	//board.printJumps();



	return 0;
}

